package com.oweight.sagacious.auth.server.domain.service;

import com.oweight.sagacious.auth.server.domain.repo.ClientServiceRepository;
import com.oweight.sagacious.common.domain.service.IBaseManager;

import java.util.List;

/**
 * @author 周广明
 * @version v1 2019/10/30 14:24
 */
public interface IClientServiceManager extends IBaseManager<ClientServiceRepository> {

    /**
     * 获取客户端Token
     *
     * @param clientId 客户端ID
     * @param secret   客户端密钥
     * @return token
     * @throws Exception
     */
    String apply(String clientId, String secret) throws Exception;

    /**
     * 获取授权的客户端列表(远程调用)
     *
     * @param serviceId 服务端ID
     * @param secret    服务密钥
     * @return
     */
    List<String> getAllowedClient(String serviceId, String secret);

    /**
     * 获取服务授权的客户端列表(服务端自检时调用)
     *
     * @param serviceId 服务端ID
     * @return
     */
    List<String> getAllowedClient(String serviceId);

    /**
     * 注册客户端
     */
    void registryClient();

    /**
     * 校验客户端
     *
     * @param clientId 客户端ID
     * @param secret   客户端密钥
     * @throws Exception
     */
    void validate(String clientId, String secret) throws Exception;
}
